import { BasicColumn } from '/src/components/Table';
import { FormSchema } from '/src/components/Table';
import { rules } from '/src/utils/helper/validator';
import { render } from '/src/utils/common/renderUtils';
import { getWeekMonthQuarterYear } from '/src/utils';
//列表数据
export const columns: BasicColumn[] = [
  // {
  //   title: '父级id',
  //   align: 'center',
  //   dataIndex: 'parentId',
  // },
  {
    title: '编号',
    align: 'center',
    dataIndex: 'themeCode',
  },
  {
    title: '主题名称',
    align: 'center',
    dataIndex: 'themeName',
  },
  {
    title: '图标',
    align: 'center',
    dataIndex: 'themeIcon',
  },
  {
    title: '层级深度',
    align: 'center',
    dataIndex: 'themeLevel',
  },
  {
    title: '完整路径',
    align: 'center',
    dataIndex: 'themePath',
  },
  {
    title: '排序权重',
    align: 'center',
    dataIndex: 'sortOrder',
  },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
  {
    label: '主题名称',
    field: 'themeName',
    component: 'Input',
  },
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '父级id',
    field: 'parentId',
    component: 'JTreeSelect',
    componentProps: {
      //字典code配置，比如通过性别字典编码：sex，也可以使用sys_permission,name,id 表名,名称,值的方式
      dict: 'sys_permission,name,id',
      //父级id字段
      pidField: 'parent_id',
    },
  },
  {
    label: '编号',
    field: 'themeCode',
    component: 'Input',
  },
  {
    label: '主题名称',
    field: 'themeName',
    component: 'Input',
  },
  {
    label: '图标',
    field: 'themeIcon',
    component: 'Input',
  },
  {
    label: '层级深度',
    field: 'themeLevel',
    component: 'InputNumber',
    helpMessage: '从0开始',
  },
  {
    label: '完整路径',
    field: 'themePath',
    component: 'Input',
    helpMessage: '如:/root/path/msg/)',
  },
  {
    label: '排序权重',
    field: 'sortOrder',
    component: 'Input',
  },
  {
    label: '',
    field: 'id',
    component: 'Input',
    show: false,
  },
];

// 高级查询数据
export const superQuerySchema = {
  parentId: { title: '父级id', order: 0, view: 'text', type: 'string' },
  themeCode: { title: '编号', order: 1, view: 'text', type: 'string' },
  themeName: { title: '主题名称', order: 2, view: 'text', type: 'string' },
  themeIcon: { title: '图标', order: 3, view: 'text', type: 'string' },
  themeLevel: { title: '层级深度', order: 4, view: 'number', type: 'number' },
  themePath: { title: '完整路径', order: 5, view: 'text', type: 'string' },
  sortOrder: { title: '排序权重', order: 6, view: 'text', type: 'string' },
};

/**
 * 流程表单调用这个方法获取formSchema
 * @param param
 */
export function getBpmFormSchema(_formData): FormSchema[] {
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}
